package com.wondream.myframework.design_pattern.factory.loan;

import com.wondream.myframework.design_pattern.factory.loan.contract.ContractStrategy;
import com.wondream.myframework.design_pattern.factory.loan.contract.DefaultContractStrategy;
import com.wondream.myframework.design_pattern.factory.loan.credit.CreditStrategy;
import com.wondream.myframework.design_pattern.factory.loan.credit.DefaultCreditStrategy;
import com.wondream.myframework.design_pattern.factory.loan.draw.DefaultDrawStrategy;
import com.wondream.myframework.design_pattern.factory.loan.draw.DrawStrategy;
import com.wondream.myframework.design_pattern.factory.loan.order.DefaultOrderStrategy;
import com.wondream.myframework.design_pattern.factory.loan.order.OrderStrategy;

public class DefaultFactory extends AbstractFactory {

    private static final DefaultFactory INSTANCE = new DefaultFactory();
    private static final OrderStrategy ORDER_STRATEGY = new DefaultOrderStrategy();
    private static final CreditStrategy CREDIT_STRATEGY = new DefaultCreditStrategy();
    private static final ContractStrategy CONTRACT_STRATEGY = new DefaultContractStrategy();
    private static final DrawStrategy DRAW_STRATEGY = new DefaultDrawStrategy();

    private DefaultFactory(){}

    public static DefaultFactory getInstance(){
        return INSTANCE;
    }

    @Override
    public OrderStrategy getOrderStrategyInstance() {
        return ORDER_STRATEGY;
    }

    @Override
    public CreditStrategy getCreditStrategyInstance() {
        return CREDIT_STRATEGY;
    }

    @Override
    public ContractStrategy getContractStrategyInstance() {
        return CONTRACT_STRATEGY;
    }

    @Override
    public DrawStrategy getDrawStrategyInstance() {
        return DRAW_STRATEGY;
    }

    public static void main(String[] args) {
        DefaultFactory.getInstance().getOrderStrategyInstance().applyOrder();
        DefaultFactory.getInstance().getCreditStrategyInstance().evaluateCredit();
        DefaultFactory.getInstance().getContractStrategyInstance().signContract();
        DefaultFactory.getInstance().getDrawStrategyInstance().draw();

    }
}
